<?php

/*db:
TRUNCATE TABLE `zakaznici~td`;
INSERT INTO `zakaznici~td` (`id_zakaznik`, `id~td`, `~from`, `~to`, `adresa`) VALUES
(1, 1, '2013-05-22', '2013-05-29', 'jinde790'),
(1, 2, '2013-05-29', '2013-06-13', 'jinde355'),
(2, 4, NULL, NULL, 'iii'),
(1, 5, '2010-06-04', '2010-06-05', 'prekryto past'),
(1, 6, '2020-06-04', '2020-06-04', 'prekryto fut'),
(1, 7, '2013-01-10', '2013-01-11', 'prekryto mid');*/
require '../loader.php';
WDB\Config::$source = __DIR__. '/../demos/pujcovna/config.php';

$table = WDB\Wrapper\TableFactory::fromName('zakaznici');

$rec = $table->getRecordByKeyForTime(time()-15*86400, 1);
$rec->setGlobalTimespan('2012-01-01', '2014-05-30');
//$rec->setGlobalTimespan(NULL, NULL);
//test na neighbour records
$rec->setTimespan('2013-01-06', '2013-04-05');
//test na surrounding record
//$rec->setTimespan('2013-05-31', '2013-06-10');
var_dump($rec->save());